package com.yuxi.mq;

import org.springframework.jms.annotation.JmsListener;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class MQConsumerService {


    private String text;

    private List lis = new ArrayList();


    @JmsListener(destination = "sample.queue")//监听指定消息队列
    public void receiveQueue(String text) {
        this.text = text;
        lis.add(text);
        System.out.println(text);
    }

    public String receive() {
        return text;
    }
}